<template>
  <div>
    <p>曝光台审核</p>
    <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column
      label="曝光描述"
      width="180"
       show-overflow-tooltip>
      <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.describes }}</el-tag>
          </div>
      </template>
    </el-table-column>
    <el-table-column
      label="曝光地址"
      width="180">
      <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.address }}</el-tag>
          </div>
      </template>
    </el-table-column>
    <el-table-column
      label="曝光图片"
      width="150">
      <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <div class="demo-image__preview">
            <el-image 
          style="width: 100px; height: 100px"
          :src="scope.row.photo" 
          :preview-src-list="srcList">
  </el-image>
            </div>
          </div>
      </template>
    </el-table-column>
    <el-table-column
      label="操作"
      width="300">
      <template slot-scope="scope">
             <el-button type="primary" size="mini" @click="reviewExposureInfo(1,scope.row.id)">通过</el-button>
             <el-button type="danger" size="mini" @click="reviewExposureInfo(2,scope.row.id)">不通过</el-button>
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data () {
    return {
      tableData: [],
      form: {
        describes: '',
        address: '',
        photo: ''
      },

      srcList:[]
    }
  },
  methods: {
     getExposureInfo(){
      axios.get("http://localhost:9091/exposureInfo/selectExposureInfo?"+
          "state=" + 0).then(res => {
            if (res.data.code == 200) {
              this.$message({
              type: "success",
              message:res.data.message
             
              });    
              this.tableData=res.data.data
              this.tableData.forEach((item) => {
                this.srcList.push(item.photo);
              });
            }
          });
    }, 
    reviewExposureInfo(state,id){
      axios.get("http://localhost:9091/exposureInfo/reviewExposureInfo?"+
          "state=" + state +
          "&id=" + id).then(res => {
            if (res.data.code == 200) {
              this.$message({
              type: "success",
              message:res.data.message
             
              });
              this.getExposureInfo();    
            }
          });
    },
  },
  mounted () {
    this.getExposureInfo();
  },
  computed: {},
};
</script>
<style scoped></style>
